#include <iostream>
#include <chrono>
#include <cstdlib>

#include "threadpool.h"

using namespace std;

int main () {
    ThreadPool thrd_pool(10);

    for (int i = 0; i < 100; ++i) {
        thrd_pool.add_task([=](){
            unsigned int seed = chrono::system_clock::now().time_since_epoch().count();
            unsigned int delay = rand_r(&seed) % 10 + 1;
            this_thread::sleep_for(chrono::milliseconds(delay * 800));
            cout << "task no:" << i << endl;
        });
    }


    this_thread::sleep_for(chrono::seconds(120));

    return 0;
}